<h2>GRASS Buffer module (v.buffer)</h2>
<p>Create a buffer around features of given type (areas must contain centroid).</p>

<p>Script Licence is GNU/GPL</p>
<hr>
<pre><code>
	
#!/usr/bin/python

# Author: Luca Casagrande ( luca.casagrande@gmail.com )

import os,time,string,sys


class Process:
    def __init__(self):
        self.Identifier = "buffer2"
        self.processVersion = "0.1"
        self.storeSupport = "true"
        self.Title="Create a buffer around a point.This one will use x1 and y1 as input"
        self.Abstract="Create a buffer around point.This one will use x1 and y1 as input"
        self.grassLocation="/home/doktoreas/data/grass/spearfish60/"
        self.Inputs = [
                    # 0
                        {
                        'Identifier': 'x1',
                        'Title': 'x coordinates',
                        'LiteralValue': {
                        },
                        'dataType': type(0.0),
                    },
                    # 1
                     {
                        'Identifier': 'y1',
                        'Title': 'y coordinates',
                        'LiteralValue': {
                            'AnyValue':None, # AllowedValues, AnyValue, ValuesReference
                        },
                        'dataType': type(0.0),
                    },
                    # 2
                        {
                        'Identifier': 'radius',
                        'Title': 'Value of the buffer',
                        'LiteralValue': {'values':["*"]},
                        'dataType' : type(0.0),
                        'value':None
                        },

                     ]
        self.Outputs = [
                #0
                {
                'Identifier': 'output',
                'Title': 'Resulting output map',                                      
                'ComplexValueReference': {
                'Formats':["text/xml"],
                }
            },
        ]

    def execute(self):
        os.system("g.mapset mapset=user1")

        os.system("echo %s,%s >> input.txt | v.in.ascii --o input=input.txt output=punto format=point fs=, skip=0 x=1 y=2 z=0 cat=0 -t 1>&2" %\
                        (self.Inputs[0]['value'],self.Inputs[1]['value']))

        os.system("v.buffer input=punto output=punto_buff type=point layer=1 buffer=%s scale=1.0 tolerance=0.01 1>&2" %\
                        (self.Inputs[2]['value']))

        os.system("v.out.ogr type=area format=GML input=punto_buff dsn=out.xml  olayer=path.xml 1>&2")

        if "out.xml" in os.listdir(os.curdir):
            self.Outputs[0]['value'] = "out.xml"
            return
        else:
            return "Output file not created"

	
</code></pre>